# !/usr/bin/env python
# -*- coding: utf-8 -*-
# @File  : 线性回归API简单使用.py
# @Author: dongguangwen
# @Date  : 2025-01-22 22:57
from sklearn.linear_model import LinearRegression

# 1.数据
x = [[160], [166], [172], [174], [180]]
y = [56.3, 60.6, 65.1, 68.5, 75]

# 2.模型训练
# 2.1 实例化
model = LinearRegression()
# 2.2模型训练
model.fit(x, y)

# 4 打印 线性回归模型参数 coef_ intercept     权重(weight)/偏置(bias)
print('estimator.coef_-->', model.coef_)
print('estimator.intercept_-->', model.intercept_)

# 5.模型预测
print(model.predict([[176]]))

"""
estimator.coef_--> [0.92942177]
estimator.intercept_--> -93.27346938775517
[70.3047619]
"""
